package com.lutzyt.delivery.controller;

import com.lutzyt.delivery.bean.req.Action;
import com.lutzyt.delivery.service.ActionService;
import com.lutzyt.delivery.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * on,off类型的通用controller
 * @author zyt
 */
public class ActionController<S extends ActionService> {

  @Autowired
  protected S actionService;

  @PostMapping("/action")
  public Result<Void> action(@RequestBody Action action) {
    actionService.action(action);
    return Result.success();
  }
}
